package com.ssm.studen.controller;

import com.ssm.studen.model.Role;
import com.ssm.studen.service.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;



/**
 * 对外提供数据服务接口

 */
@Api(tags = "role")
@RestController

public class RoleController {
    @Autowired
       private RoleService roleService;
    @ApiOperation(value = "角色添加方法")
    @RequestMapping(value = "/addRole",method = RequestMethod.GET)
    public int AddRole(Role role){
        int IsAdd=0;
        //传入数据的判断
        // （1）实体对象不能为空
        if (role != null) {
            //(2)角色名称不能为空
            if (role.getRolename()!= null) {
                //(3)添加角色数据
               IsAdd=roleService.AddRole(role);
            }

        }
        return  IsAdd;

    }

}
